class DepositContract:
    """
    存款合同
    """
    def __init__(self, contract):
        if len(contract) > 0:
            self.bank_id = contract['bank_id']
            self.amount = contract['amount']
            self.interest_rate = contract['interest_rate']
            self.interest_per_year = contract['interest_per_year']
            self.text = contract['text']

            if 'firm_id' in contract:
                self.firm_id = contract['firm_id']
            if 'household_id' in contract:
                self.household_id = contract['household_id']


class LoanContract:
    """
    贷款合同
    """
    def __init__(self, contract):
        if len(contract) > 0:
            if 'bank_id' in contract:
                self.bank_id = contract['bank_id']
            if 'amount' in contract:
                self.amount = contract['amount']
            if 'interest_rate' in contract:
                self.interest_rate = contract['interest_rate']
            if 'firm_id' in contract:
                self.firm_id = contract['firm_id']
            if 'household_id' in contract:
                self.household_id = contract['household_id']
            if 'contract_year' in contract:
                self.contract_year = contract['contract_year']
            if 'left_year' in contract:
                self.left_year = contract['left_year']


class JobContract:
    """
    劳动力合同
    """
    def __init__(self, contract):
        self.wage = contract['wage']
        self.household_id = contract['household_id']
        self.employer = contract['employer']
        self.employed = contract['employed']


class ConsumptionGoodsContract:
    """
    消费品供需合同
    """
    def __init__(self, contract):
        self.household_id = contract['household_id']
        self.c_firm_id = contract['c_firm_id']
        self.price = contract['price']
        self.quantity = contract['quantity']